package tom.change.人脸识别;

import java.util.HashMap;

import org.json.JSONObject;

import com.baidu.aip.face.AipFace;

public class Sample {

    //设置APPID/AK/SK
    public static final String APP_ID = "9372483";
    public static final String API_KEY = "d2e5Lxm9vjCkmHfUY6c3ZXe2";
    public static final String SECRET_KEY = "HYs8QwBL8Fgz1S15tjjLHOfgsBwbWPS3";

    
    public static void main(String[] args) {

        // 初始化一个FaceClient
        AipFace client = new AipFace(APP_ID, API_KEY, SECRET_KEY);

        // 可选：设置网络连接参数
        client.setConnectionTimeoutInMillis(2000);
        client.setSocketTimeoutInMillis(60000);

        // 调用API
        String image = "D:\\zxh\\test\\1.png";
        JSONObject res = client.detect(image, new HashMap<String, String>());
        System.out.println(res.toString(2));
    }
}
